using System;
using System.Collections.Generic;
using System.Text;
using NBusiness.Query;

namespace NBusiness.Data.Web
{
    /// <summary>
    /// Argument object used in the Select event.
    /// </summary>
    public class SelectEntityEventArgs : EventArgs
    {
        private IEntityCollection _entities;

        /// <summary>
        /// Get or set a reference to the business object
        /// that is created and populated by the Select
        /// event handler in the web page.
        /// </summary>
        /// <value>A reference to a business object.</value>
        public IEntityCollection Entities
        {
            get { return _entities; }
            set { _entities = value; }
        }

        private int _startIndex;

        public int StartIndex
        {
            get { return _startIndex; }
        }
        private int _maxRows = -1;

        public int MaxRows
        {
            get { return _maxRows; }
        }

        private string _sortField;

        public string SortField
        {
            get { return _sortField; }
        }
        private SortOrder _sortOrder = SortOrder.None;

        public SortOrder SortOrder
        {
            get { return _sortOrder; }
        }

        private int _totalRows = -1;
        public int TotalRows
        {
            get { return _totalRows; }
            set { _totalRows = value; }
        }

        public SelectEntityEventArgs() { }
        public SelectEntityEventArgs(int startIndex, int maxRows, string sortField, SortOrder sortOrder)
        {
            _startIndex = startIndex;
            _maxRows = maxRows;
            _sortField = sortField;
            _sortOrder = sortOrder;
        }
    }
}
